﻿using Kw.Combinatorics;
using System;

namespace Kw.CombinatoricsExamples
{
    class PnExample01
    {
        static void Main ()
        {
            int order = 4;

            var pn = new Permutation (order);

            Console.WriteLine ("order={0}\n", pn.Width);

            foreach (var row in pn.GetRows())
                Console.WriteLine ("Rank={0,2}:  {1}", row.Rank, row);
        }

        /* Output:

        order=4

        Rank= 0:  { 0, 1, 2, 3 }
        Rank= 1:  { 0, 1, 3, 2 }
        Rank= 2:  { 0, 2, 1, 3 }
        Rank= 3:  { 0, 2, 3, 1 }
        Rank= 4:  { 0, 3, 1, 2 }
        Rank= 5:  { 0, 3, 2, 1 }
        Rank= 6:  { 1, 0, 2, 3 }
        Rank= 7:  { 1, 0, 3, 2 }
        Rank= 8:  { 1, 2, 0, 3 }
        Rank= 9:  { 1, 2, 3, 0 }
        Rank=10:  { 1, 3, 0, 2 }
        Rank=11:  { 1, 3, 2, 0 }
        Rank=12:  { 2, 0, 1, 3 }
        Rank=13:  { 2, 0, 3, 1 }
        Rank=14:  { 2, 1, 0, 3 }
        Rank=15:  { 2, 1, 3, 0 }
        Rank=16:  { 2, 3, 0, 1 }
        Rank=17:  { 2, 3, 1, 0 }
        Rank=18:  { 3, 0, 1, 2 }
        Rank=19:  { 3, 0, 2, 1 }
        Rank=20:  { 3, 1, 0, 2 }
        Rank=21:  { 3, 1, 2, 0 }
        Rank=22:  { 3, 2, 0, 1 }
        Rank=23:  { 3, 2, 1, 0 }

        */
    }
}
